// Hooks

ContraptionSaver.Hooks = {}
ContraptionSaver.Hooks.List = {}

// Add a hook

function ContraptionSaver.Hooks.Add(ID, Function)
	ContraptionSaver.Hooks.List[ID] = ContraptionSaver.Hooks.List[ID] or {}
	
	table.insert(ContraptionSaver.Hooks.List[ID], Function)
end

// Call a hook

function ContraptionSaver.Hooks.Call(ID, ...)
	if (ContraptionSaver.Hooks.List[ID]) then
		for K, V in pairs(ContraptionSaver.Hooks.List[ID]) do
			if (V) then
				local B, Error = pcall(V, unpack(arg))
				
				if (!B) then
					Msg("[Contraption Saver] Hook error: "..Error.."!\n")
				end
			end
		end
	end
end